package com.jddup.program.dao.sqlbuilder.postgresql;

import com.jddup.common.pojo.TableMeta;
import com.jddup.program.dao.sqlbuilder.DeletePrepareSQLBuilder;

/**
 * Postgresql 删除SQL构建器
 * Created by ZZB on 2017/10/19.
 */
public class PostgresqlDeletePrepareSQLBuilder implements DeletePrepareSQLBuilder {
	private static final String DELETE_BY_PK_FMT = "delete from {tableName} where {pkName} = ?";

	@Override
	public String buildDeleteSQL(TableMeta tableMeta) {
		return DELETE_BY_PK_FMT.replace("{tableName}", tableMeta.getTableName()).replace("{pkName}",
				"\"" + tableMeta.getPrimaryKeyColumn().getColumnName() + "\"");
	}
}
